﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-7-9
/// Purpose: 		正在处理的工作任务集合
/// ****************************************************************************
/// Modify By		Date			Remark
/// ****************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSF.JobNotifier.Data;

namespace CSF.JobNotifier.BLL
{
    /// <summary>
    /// 正在处理的工作任务集合
    /// </summary>
    public class JobSet : RB.Domain.RelationalMapping.KeyedRecordSet<Job, string>
    {
        public override bool Contains(Job item)
        {
            return base.Any(p => p.JobNo == item.JobNo);
        }

        public override bool Remove(Job item)
        {
            int count = base.RemoveAll(p => p.JobNo == item.JobNo);
            return count > 0;
        }

        public override Job this[string key]
        {
            get
            {
                return base.Single(p => p.JobNo == key);
            }
            set
            {
                this.Update(p => value, p => p.JobNo == key);
            }
        }
    }
}
